package com.weimob.mcloud.wechatwork.customer.service.user.exception;

import lombok.Data;

@Data
public class BizException extends RuntimeException {

    private Long errcode;

    private String errmsg;

    private String corpId;

    private String pid;

    /**
     * Constructs a new runtime exception with {@code null} as its detail message.  The cause is not
     * initialized, and may subsequently be initialized by a call to {@link #initCause}.
     */
    public BizException(Long errcode, String errmsg) {
    	super(errmsg);
        this.errcode = errcode;
        this.errmsg = errmsg;
    }

    public BizException(String errmsg) {
        this(BaseErrorCode.FAILED.getCode(), errmsg);
    }

    public BizException(BaseErrorCode baseErrorCode) {
        this(baseErrorCode.getCode(), baseErrorCode.getMsg());
    }
}
